package com.before.servlet;

import com.before.dao.StudentDao;
import com.before.dao.StudentDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/stu")
public class StudentServlet extends HttpServlet {

    StudentDao studentDao = new StudentDaoImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<String> names = studentDao.getAll();
        //System.out.println(System.currentTimeMillis());
        req.setAttribute("names",names);
        //转发
        req.getRequestDispatcher("three.jsp").forward(req,resp);
    }
}
